<!doctype html><html lang=en dir=auto>
<head><meta charset=utf-8>
<meta http-equiv=x-ua-compatible content="IE=edge">
<meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no">
<meta name=robots content="index, follow">
<title>Android开发杂货 | wenbin</title>
<meta name=keywords content>
<meta name=description content>
<meta name=author content>
<link rel=canonical href=https://imwenbin.com/tags/android%E5%BC%80%E5%8F%91%E6%9D%82%E8%B4%A7/>
<link crossorigin=anonymous href=/assets/css/stylesheet.min.css rel="preload stylesheet" as=style>
<link rel=icon href=https://imwenbin.com/favicon.ico>
<link rel=icon type=image/png sizes=16x16 href=https://imwenbin.com/favicon16x16.png>
<link rel=icon type=image/png sizes=32x32 href=https://imwenbin.com/favicon32x32.png>
<link rel=apple-touch-icon href=https://imwenbin.com/apple_touch_icon.png>
<link rel=mask-icon href=https://imwenbin.com/safari_pinned_tab.svg>
<meta name=theme-color content="#2e2e33">
<meta name=msapplication-TileColor content="#2e2e33">
<meta name=generator content="Hugo 0.89.3">
<link rel=alternate type=application/rss+xml href=https://imwenbin.com/tags/android%E5%BC%80%E5%8F%91%E6%9D%82%E8%B4%A7/index.xml>
<noscript>
<style>#theme-toggle,.top-link{display:none}</style>
<style>@media(prefers-color-scheme:dark){:root{--theme:rgb(29, 30, 32);--entry:rgb(46, 46, 51);--primary:rgb(218, 218, 219);--secondary:rgb(155, 156, 157);--tertiary:rgb(65, 66, 68);--content:rgb(196, 196, 197);--hljs-bg:rgb(46, 46, 51);--code-bg:rgb(55, 56, 62);--border:rgb(51, 51, 51)}.list{background:var(--theme)}.list:not(.dark)::-webkit-scrollbar-track{background:0 0}.list:not(.dark)::-webkit-scrollbar-thumb{border-color:var(--theme)}}</style>
</noscript><meta property="og:title" content="Android开发杂货">
<meta property="og:description" content>
<meta property="og:type" content="website">
<meta property="og:url" content="https://imwenbin.com/tags/android%E5%BC%80%E5%8F%91%E6%9D%82%E8%B4%A7/"><meta property="og:site_name" content="wenbin">
<meta name=twitter:card content="summary">
<meta name=twitter:title content="Android开发杂货">
<meta name=twitter:description content>
</head>
<body class=list id=top>
<script>localStorage.getItem("pref-theme")==="dark"?document.body.classList.add('dark'):localStorage.getItem("pref-theme")==="light"?document.body.classList.remove('dark'):window.matchMedia('(prefers-color-scheme: dark)').matches&&document.body.classList.add('dark')</script>
<header class=header>
<nav class=nav>
<div class=logo>
<a href=https://imwenbin.com/ accesskey=h title="wenbin (Alt + H)">wenbin</a>
<span class=logo-switches>
<button id=theme-toggle accesskey=t title="(Alt + T)"><svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg><svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>
</button>
</span>
</div>
<ul id=menu>
<li>
<a href=https://imwenbin.com/blog/ title=Blog>
<span>Blog</span>
</a>
</li>
<li>
<a href=https://imwenbin.com/archives title=Archive>
<span>Archive</span>
</a>
</li>
<li>
<a href=https://imwenbin.com/tags title=Tags>
<span>Tags</span>
</a>
</li>
</ul>
</nav>
</header>
<main class=main>
<header class=page-header><div class=breadcrumbs><a href=https://imwenbin.com/>Home</a>&nbsp;»&nbsp;<a href=https://imwenbin.com/tags/>Tags</a></div>
<h1>Android开发杂货</h1>
</header>
<article class="post-entry tag-entry">
<header class=entry-header>
<h2>「Android」SearchView点击没有反应
</h2>
</header>
<section class=entry-content>
<p> 开发中，遇到在导航栏上添加 SearchView时，只有点击🔍图标才能弹出软键盘，点击其他区域不响应的问题
监听 searchView 的点击事件 OnClickListener searchView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 弹出软键盘 searchView.setIconified(false); // 切换 Fragment getSupportFragmentManager().beginTransaction().replace(R.id.main_container, new SearchViewFragment()).commitAllowingStateLoss(); } }); 监听 searchView 点击 x 取消的事件 searchView.setOnCloseListener(new SearchView.OnCloseListener() { @Override public boolean onClose() { // 切换回 Fragment getSupportFragmentManager().beginTransaction().replace(R.id.main_container, homeFragment).commitAllowingStateLoss(); // return true的话 searchView还是在响应状态 return false; } }); </p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:53:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to 「Android」SearchView点击没有反应" href=https://imwenbin.com/blog/androidsearchview%E7%82%B9%E5%87%BB%E6%B2%A1%E6%9C%89%E5%8F%8D%E5%BA%94/></a>
</article>
<article class="post-entry tag-entry">
<header class=entry-header>
<h2>「Android」菜单栏背景色设置
</h2>
</header>
<section class=entry-content>
<p>getWindow().setStatusBarColor(getResources().getColor(R.color.colorTint)); </p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:52:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to 「Android」菜单栏背景色设置" href=https://imwenbin.com/blog/android%E8%8F%9C%E5%8D%95%E6%A0%8F%E8%83%8C%E6%99%AF%E8%89%B2%E8%AE%BE%E7%BD%AE/></a>
</article>
<article class="post-entry tag-entry">
<header class=entry-header>
<h2>「Android开发」Activity常用跳转动画2种
</h2>
</header>
<section class=entry-content>
<p>一、类似iOS右进右出 rightIn_enter &lt;?xml version="1.0" encoding="utf-8"?> &lt;set xmlns:android="http://schemas.android.com/apk/res/android"> &lt;translate android:fromXDelta="100%" android:toXDelta="0" android:duration="300" /> &lt;/set> rightIn_exit &lt;?xml version="1.0" encoding="utf-8"?> &lt;set xmlns:android="http://schemas.android.com/apk/res/android"> &lt;translate android:fromXDelta="0" android:toXDelta="-100%" android:duration="300" /> &lt;/set> rightOut_enter &lt;?xml version="1.0" encoding="utf-8"?> &lt;set xmlns:android="http://schemas.android.com/apk/res/android"> &lt;translate android:fromXDelta="-100%" android:toXDelta="0" android:duration="300" /> &lt;/set> rightOut_exit &lt;?xml version="1.0" encoding="utf-8"?> &lt;set xmlns:android="http://schemas.android.com/apk/res/android"> &lt;translate android:fromXDelta="0" android:toXDelta="100%" android:duration="300" /> &lt;/set> 二、从下弹出和落下 bottomIn_enter &lt;?xml version="1.0" encoding="utf-8"?> &lt;set xmlns:android="http://schemas.android.com/apk/res/android"> &lt;translate android:duration="300" android:fromYDelta="100%" android:toYDelta="0" /> &lt;/set> bottomIn_exit &lt;?xml version="1.0" encoding="utf-8"?> &lt;set xmlns:android="http://schemas.android.com/apk/res/android"> &lt;translate android:duration="300" android:fromYDelta="0" android:toYDelta="0"/> &lt;/set> bottomOut_enter &lt;?...</p>
</section>
<footer class=entry-footer><span title="2021-11-18 09:51:36 +0800 CST">⌚️ 2021-11-18</span></footer>
<a class=entry-link aria-label="post link to 「Android开发」Activity常用跳转动画2种" href=https://imwenbin.com/blog/android%E5%BC%80%E5%8F%91activity%E5%B8%B8%E7%94%A8%E8%B7%B3%E8%BD%AC%E5%8A%A8%E7%94%BB2%E7%A7%8D/></a>
</article>
<footer class=page-footer>
<nav class=pagination>
<a class=prev href=https://imwenbin.com/tags/android%E5%BC%80%E5%8F%91%E6%9D%82%E8%B4%A7/>« Prev Page</a>
</nav>
</footer>
</main>
<footer class=footer>
<span>&copy; 2021 <a href=https://imwenbin.com/>wenbin</a>.</span>
<span>
保留部分权利。
</span>
</footer>
<a href=#top aria-label="go to top" title="Go to Top (Alt + G)" class=top-link id=top-link accesskey=g><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentcolor"><path d="M12 6H0l6-6z"/></svg>
</a>
<script>let menu=document.getElementById('menu');menu&&(menu.scrollLeft=localStorage.getItem("menu-scroll-position"),menu.onscroll=function(){localStorage.setItem("menu-scroll-position",menu.scrollLeft)}),document.querySelectorAll('a[href^="#"]').forEach(a=>{a.addEventListener("click",function(b){b.preventDefault();var a=this.getAttribute("href").substr(1);window.matchMedia('(prefers-reduced-motion: reduce)').matches?document.querySelector(`[id='${decodeURIComponent(a)}']`).scrollIntoView():document.querySelector(`[id='${decodeURIComponent(a)}']`).scrollIntoView({behavior:"smooth"}),a==="top"?history.replaceState(null,null," "):history.pushState(null,null,`#${a}`)})})</script>
<script>var mybutton=document.getElementById("top-link");window.onscroll=function(){document.body.scrollTop>800||document.documentElement.scrollTop>800?(mybutton.style.visibility="visible",mybutton.style.opacity="1"):(mybutton.style.visibility="hidden",mybutton.style.opacity="0")}</script>
<script>document.getElementById("theme-toggle").addEventListener("click",()=>{document.body.className.includes("dark")?(document.body.classList.remove('dark'),localStorage.setItem("pref-theme",'light')):(document.body.classList.add('dark'),localStorage.setItem("pref-theme",'dark'))})</script>
</body>
</html>